<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>GeoExt.form.SearchAction &mdash; GeoExt v1.0</title>
    <link rel="stylesheet" href="../../../../_static/geoext.css" type="text/css" />
    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../../',
        VERSION:     '1.0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../../../../_static/favicon.ico"/>
    <link rel="top" title="GeoExt v1.0" href="../../../../index.html" />
    <link rel="up" title="Widgets" href="../../widgets.html" />
    <link rel="next" title="GeoExt.grid.FeatureSelectionModel" href="../grid/FeatureSelectionModel.html" />
    <link rel="prev" title="GeoExt.form.FormPanel" href="FormPanel.html" />
    
    
    
    
    

  </head>
  <body>
    <div class="header">
        <div class="wrap">
            <h1 id="logo"><a href="../../../../index.html">GeoExt</a></h1>
            <ul id="top-nav">
                <li class="first"><a href="../../../../docs.html">Documentation</a></li>
                <li><a href="../../../../examples.html">Examples</a></li>
                <li><a href="../../../../downloads.html">Download</a></li>
                <li><a href="http://trac.geoext.org/">Development</a></li>
            </ul>
            <div id="searchbox">
                <form class="search" action="../../../../search.html" method="get">
                    <input id="searchbox-query" type="text" name="q" size="25" value="Search &hellip;" tabindex="3" onblur="if(this.value=='') this.value='Search &hellip;';" onfocus="if(this.value=='Search &hellip;') this.value='';" />
                    <input id="searchbox-submit" type="image" value="Search" src="../../../../_static/img/search_icon_green.png" />
                    <input type="hidden" name="check_keywords" value="yes" />
                    <input type="hidden" name="area" value="default" />
                </form>
            </div>
        </div>
    </div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li><a href="../../../../index.html">GeoExt</a> &raquo;</li>
          <li><a href="../../../index.html" >API Reference</a> &raquo;</li>
          <li><a href="../../widgets.html" accesskey="U">Widgets</a> &raquo;</li>
        <li><a href="#"><tt class="docutils literal docutils literal"><span class="pre">GeoExt.form.SearchAction</span></tt></a></li>
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../../../../index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#"><tt class="docutils literal"><span class="pre">GeoExt.form.SearchAction</span></tt></a><ul>
<li><a class="reference external" href="#example-use">Example Use</a></li>
<li><a class="reference external" href="#public-properties">Public Properties</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="FormPanel.html"
                                  title="previous chapter"><tt class="docutils literal docutils literal docutils literal"><span class="pre">GeoExt.form.FormPanel</span></tt></a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="../grid/FeatureSelectionModel.html"
                                  title="next chapter"><tt class="docutils literal"><span class="pre">GeoExt.grid.FeatureSelectionModel</span></tt></a></p>
        </div>
      </div>


    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="geoext-form-searchaction">
<h1><a title="GeoExt.form.SearchAction" class="reference internal" href="#GeoExt.form.SearchAction"><tt class="xref docutils literal"><span class="pre">GeoExt.form.SearchAction</span></tt></a><a class="headerlink" href="#geoext-form-searchaction" title="Permalink to this headline">¶</a></h1>
<dl class="meta docutils">
<dt>Extends</dt>
<dd><ul class="first last simple">
<li><a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.form.Action">Ext.form.Action</a></li>
</ul>
</dd>
</dl>
<dl class="class">
<dt id="GeoExt.form.SearchAction">
<em class="property">class </em><tt class="descclassname">GeoExt.form.</tt><tt class="descname">SearchAction</tt><big>(</big><em>form</em>, <em>options</em><big>)</big><a class="headerlink" href="#GeoExt.form.SearchAction" title="Permalink to this definition">¶</a></dt>
<dd><p>A specific <tt class="docutils literal"><span class="pre">Ext.form.Action</span></tt> to be used when using a form to do
trigger search requests througn an <tt class="docutils literal"><span class="pre">OpenLayers.Protocol</span></tt>.</p>
<p>Arguments:</p>
<ul>
<li><p class="first">form <tt class="docutils literal"><span class="pre">Ext.form.BasicForm</span></tt> A basic form instance.</p>
</li>
<li><dl class="first docutils">
<dt>options <tt class="docutils literal"><span class="pre">Object</span></tt> Options passed to the protocol&#8217;read method</dt>
<dd><p class="first last">One can add an abortPrevious property to these options, if set
to true, the abort method will be called on the protocol if
there&#8217;s a pending request.</p>
</dd>
</dl>
</li>
</ul>
<p>When run this action builds an <tt class="docutils literal"><span class="pre">OpenLayers.Filter</span></tt> from the form
and passes this filter to its protocol&#8217;s read method. The form fields
must be named after a specific convention, so that an appropriate
<tt class="docutils literal"><span class="pre">OpenLayers.Filter.Comparison</span></tt> filter is created for each
field.</p>
<p>For example a field with the name <tt class="docutils literal"><span class="pre">foo__like</span></tt> would result in an
<tt class="docutils literal"><span class="pre">OpenLayers.Filter.Comparison</span></tt> of type
<tt class="docutils literal"><span class="pre">OpenLayers.Filter.Comparison.LIKE</span></tt> being created.</p>
<p>Here is the convention:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">&lt;name&gt;__eq:</span> <span class="pre">OpenLayers.Filter.Comparison.EQUAL_TO</span></tt></li>
<li><tt class="docutils literal"><span class="pre">&lt;name&gt;__ne:</span> <span class="pre">OpenLayers.Filter.Comparison.NOT_EQUAL_TO</span></tt></li>
<li><tt class="docutils literal"><span class="pre">&lt;name&gt;__lt:</span> <span class="pre">OpenLayers.Filter.Comparison.LESS_THAN</span></tt></li>
<li><tt class="docutils literal"><span class="pre">&lt;name&gt;__le:</span> <span class="pre">OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO</span></tt></li>
<li><tt class="docutils literal"><span class="pre">&lt;name&gt;__gt:</span> <span class="pre">OpenLayers.Filter.Comparison.GREATER_THAN</span></tt></li>
<li><tt class="docutils literal"><span class="pre">&lt;name&gt;__ge:</span> <span class="pre">OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO</span></tt></li>
<li><tt class="docutils literal"><span class="pre">&lt;name&gt;__like:</span> <span class="pre">OpenLayers.Filter.Comparison.LIKE</span></tt></li>
</ul>
<p>In most cases your would not directly create <tt class="docutils literal"><span class="pre">GeoExt.form.SearchAction</span></tt>
objects, but use <a title="GeoExt.form.FormPanel" class="reference external" href="FormPanel.html#GeoExt.form.FormPanel"><tt class="xref docutils literal"><span class="pre">GeoExt.form.FormPanel</span></tt></a> instead.</p>
</dd></dl>

<div class="section" id="example-use">
<h2>Example Use<a class="headerlink" href="#example-use" title="Permalink to this headline">¶</a></h2>
<p>Sample code showing how to use a GeoExt SearchAction with an Ext form panel:</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="kd">var</span> <span class="nx">formPanel</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Ext</span><span class="p">.</span><span class="nx">form</span><span class="p">.</span><span class="nx">Panel</span><span class="p">({</span>
    <span class="nx">renderTo</span><span class="o">:</span> <span class="s2">&quot;formpanel&quot;</span><span class="p">,</span>
    <span class="nx">items</span><span class="o">:</span> <span class="p">[{</span>
        <span class="nx">xtype</span><span class="o">:</span> <span class="s2">&quot;textfield&quot;</span><span class="p">,</span>
        <span class="nx">name</span><span class="o">:</span> <span class="s2">&quot;name__like&quot;</span><span class="p">,</span>
        <span class="nx">value</span><span class="o">:</span> <span class="s2">&quot;mont&quot;</span>
    <span class="p">},</span> <span class="p">{</span>
        <span class="nx">xtype</span><span class="o">:</span> <span class="s2">&quot;textfield&quot;</span><span class="p">,</span>
        <span class="nx">name</span><span class="o">:</span> <span class="s2">&quot;elevation__ge&quot;</span><span class="p">,</span>
        <span class="nx">value</span><span class="o">:</span> <span class="s2">&quot;2000&quot;</span>
    <span class="p">}]</span>
<span class="p">});</span>

<span class="kd">var</span> <span class="nx">searchAction</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">GeoExt</span><span class="p">.</span><span class="nx">form</span><span class="p">.</span><span class="nx">SearchAction</span><span class="p">(</span><span class="nx">formPanel</span><span class="p">.</span><span class="nx">getForm</span><span class="p">(),</span> <span class="p">{</span>
    <span class="nx">protocol</span><span class="o">:</span> <span class="k">new</span> <span class="nx">OpenLayers</span><span class="p">.</span><span class="nx">Protocol</span><span class="p">.</span><span class="nx">WFS</span><span class="p">({</span>
        <span class="nx">url</span><span class="o">:</span> <span class="s2">&quot;http://publicus.opengeo.org/geoserver/wfs&quot;</span><span class="p">,</span>
        <span class="nx">featureType</span><span class="o">:</span> <span class="s2">&quot;tasmania_roads&quot;</span><span class="p">,</span>
        <span class="nx">featureNS</span><span class="o">:</span> <span class="s2">&quot;http://www.openplans.org/topp&quot;</span>
    <span class="p">}),</span>
    <span class="nx">abortPrevious</span><span class="o">:</span> <span class="kc">true</span>
<span class="p">});</span>

<span class="nx">formPanel</span><span class="p">.</span><span class="nx">getForm</span><span class="p">().</span><span class="nx">doAction</span><span class="p">(</span><span class="nx">searchAction</span><span class="p">,</span> <span class="p">{</span>
    <span class="nx">callback</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">response</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// response.features includes the features read</span>
        <span class="c1">// from the server through the protocol</span>
    <span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
<div class="section" id="public-properties">
<h2>Public Properties<a class="headerlink" href="#public-properties" title="Permalink to this headline">¶</a></h2>
<p>Public properties in addition to those
listed for <a class="reference external" href="http://dev.sencha.com/deploy/dev/docs/?class=Ext.form.Action">Ext.form.Action</a>.</p>
<dl class="attribute">
<dt id="GeoExt.form.SearchAction.response">
<tt class="descclassname">SearchAction.</tt><tt class="descname">response</tt><a class="headerlink" href="#GeoExt.form.SearchAction.response" title="Permalink to this definition">¶</a></dt>
<dd><tt class="docutils literal"><span class="pre">OpenLayers.Protocol.Response</span></tt> A reference to the response
resulting from the search request. Read-only.</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
            <li class="right" style="margin-right: 10px">
              <a href="../../../../genindex.html" title="General Index"
                 accesskey="I">index</a></li>
            <li class="right" >
              <a href="../../../../modindex.html" title="Global Module Index"
                 accesskey="M">modules</a> |</li>
            <li class="right" >
              <a href="../grid/FeatureSelectionModel.html" title="GeoExt.grid.FeatureSelectionModel"
                 accesskey="N">next</a> |</li>
            <li class="right" >
              <a href="FormPanel.html" title="GeoExt.form.FormPanel"
                 accesskey="P">previous</a> |</li>
        <li><a href="../../../../index.html">GeoExt</a> &raquo;</li>
          <li><a href="../../../index.html" >API Reference</a> &raquo;</li>
          <li><a href="../../widgets.html" >Widgets</a> &raquo;</li>
        <li><a href="#"><tt class="docutils literal docutils literal"><span class="pre">GeoExt.form.SearchAction</span></tt></a></li>
      </ul>
    </div>

    <div class="footer">
      &copy; Copyright 2009-2010, GeoExt Community.
    </div>
  </body>
</html>